QT += network \
    xml
TARGET = amaze
TEMPLATE = app
SOURCES += src/main.cpp \
    src/amaze.cpp \
    src/parse.cpp \
    src/download.cpp \
    src/about.cpp \
    src/settings.cpp \
    src/config.cpp \
    src/console.cpp \
    src/format_help.cpp \
    src/license.cpp \
    src/des.c
HEADERS += src/amaze.h \
    src/parse.h \
    src/download.h \
    src/common.h \
    src/about.h \
    src/settings.h \
    src/config.h \
    src/console.h \
    src/format_help.h \
    src/license.h \
    src/des.h
RESOURCES = amaze.qrc
INCLUDEPATH += src
FORMS += src/about.ui \
    src/settings.ui

RC_FILE = amaze.rc
ICON = amaze.icns

CUSTOM_BUILD_FOLDERS = true

win32{
    win32-msvc* {
        # exclude MSVC - otherwise requires full rebuilds when changing between release/debug
        CUSTOM_BUILD_FOLDERS = false
    }
}

unix {
    CCACHE = $$system(which ccache)
    !isEmpty(CCACHE) {
        message("using ccache")
        QMAKE_CXX = ccache \
            g++
        QMAKE_CC = ccache \
            gcc
    }
    !mac {
        isEmpty( PREFIX ) {
            PREFIX = /usr/local
            message( "You can provide your own prefix." )
            message( "Example: PREFIX=\"/usr\" qmake-qt4" )
        }
        message( "Amaze will be installed in $${PREFIX}" )
        BINDIR = $$PREFIX/bin
        DATADIR = $$PREFIX/share
        target.path = $${BINDIR}
        desktop.path = $${DATADIR}/applications
        desktop.files = amaze.desktop
        icon16.path = $${DATADIR}/icons/hicolor/16x16/apps
        icon16.files = resources/icons/16x16/amaze.png
        icon32.path = $${DATADIR}/icons/hicolor/32x32/apps
        icon32.files = resources/icons/32x32/amaze.png
        icon64.path = $${DATADIR}/icons/hicolor/64x64/apps
        icon64.files = resources/icons/64x64/amaze.png
        mime-packages.path = $${DATADIR}/mime/packages
        mime-packages.files = mime/amaze.xml
        mime-info.path = $${DATADIR}/mime-info
        mime-info.files = mime/amaze.keys mime/amaze.mime
        INSTALLS = target \
            desktop \
            icon16 \
            icon32 \
            icon64 \
            mime-packages \
            mime-info
    }
}

contains(CUSTOM_BUILD_FOLDERS, true) {
    OBJECTS_DIR = build/.o
    UI_DIR = build/.ui
    MOC_DIR = build/.moc
    RCC_DIR = build/.rcc
}
